﻿using System;
using System.Data;
using System.Configuration;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Collections.Specialized;
using System.ComponentModel;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// List box which contains list items one or more of which can be selected.
	/// </summary>
	public class ListBox : BaseMultiValueListControl//, ISelectListControl
	{
		#region PUBLIC
		#region INIT
		/// <summary>
		/// Ctor.
		/// </summary>
		public ListBox()
		{
			//
			// TODO: Add constructor logic here
			//
			Rows = 3;
		}
		#endregion
		#region PROPS
		/// <summary>
		/// If set to true, multiple items can be selected at once.
		/// </summary>
		[DefaultValue(false)]
		public bool Multiple { get; set; }
		/// <summary>
		/// Number of rows to display, sets the "size" attribute.
		/// </summary>
		[DefaultValue(3)]
		public int Rows { get; set; }
		#endregion
		#endregion
		#region INTERNAL
		/// <summary>
		/// Adds the "multiple" and "size" attributes.
		/// </summary>
		/// <param name="writer"></param>
		protected override void AddAttributesToRender(HtmlTextWriter writer)
		{
			if (Multiple)
				writer.AddAttribute(HtmlTextWriterAttribute.Multiple, "true");

			writer.AddAttribute(HtmlTextWriterAttribute.Size, Rows.ToString());
			base.AddAttributesToRender(writer);
		}
		//protected internal override void RegisterIncludes(IncludeCollection includes)
		//{
		//  base.RegisterIncludes(includes);

		//  SelectListControlCommon.RegisterIncludes(this, includes);
		//}
		#endregion
	}
}